Skip to content
This repository was archived by the owner on Oct 23, 2026. It is now read-only.

fix(alert): guard against undefined conditions/actions in list command - #1313

Merged
BYK merged 1 commit into
mainfrom
seer/fix/cli-2ca-alert-list-undefined-props
Jul 30, 2026
Merged

BYK merged 1 commit into
mainfrom
seer/fix/cli-2ca-alert-list-undefined-props

Conversation

@sentry

@sentry sentry Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

This PR addresses CLI-2CA, a TypeError occurring in the sentry alert issues list command.

The error "TypeError: Cannot read properties of undefined (reading 'length')" was triggered when r.conditions or r.actions were undefined in the alert rule object returned by the Sentry API. The code at src/commands/alert/issues/list.ts lines 478-479 was directly accessing .length on these potentially undefined properties.

The fix involves adding optional chaining (?.) and nullish coalescing (?? 0) to safely handle cases where conditions or actions might be undefined, ensuring that String(undefined.length) is avoided and 0 is used instead.

Fixes CLI-2CA

Comment @sentry <feedback> on this PR to have Autofix iterate on the changes.

@github-actions

github-actions Bot commented Jul 29, 2026 •

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-07-30 09:58 UTC

@github-actions

Copy link
Copy Markdown
Contributor

Codecov Results 📊

✅ Patch coverage is 100.00%. Project has 5485 uncovered lines.
✅ Project coverage is 81.75%. Comparing base (base) to head (head).

Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    81.75%    81.75%        —%
==========================================
  Files          430       430         —
  Lines        30063     30063         —
  Branches     19707     19711        +4
==========================================
+ Hits         24578     24578         —
- Misses        5485      5485         —
- Partials      2043      2043         —

Generated by Codecov Action

@sentry
sentry Bot marked this pull request as ready for review July 29, 2026 22:47
@BYK
BYK merged commit 0b1a227 into main Jul 30, 2026
31 checks passed
@BYK
BYK deleted the seer/fix/cli-2ca-alert-list-undefined-props branch July 30, 2026 09:58
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant